//
//  WKImagePickerController.m
//  WKLottery
//
//  Created by mry on 2017/11/2.
//  Copyright © 2017年 zc. All rights reserved.
//

#import "LGTImagePickerVC.h"
#define UIColorFromRGBAlph(rgbValue,alpah) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alpah]
#define MainColor UIColorFromRGBAlph(0xFFB21A, 1)

@interface LGTImagePickerVC ()

@end

@implementation LGTImagePickerVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationBar.translucent = NO;
    [self.navigationBar setBackgroundImage:[self createImageWithColor:MainColor] forBarMetrics:UIBarMetricsDefault];
}

- (UIImage *) createImageWithColor:(UIColor*) color
{
    CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    if (self.viewControllers.count) {
        viewController.hidesBottomBarWhenPushed = YES;
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"rank_list_icon_back"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(backHandler:)];
    }
    [super pushViewController:viewController animated:animated];
}

- (void)backHandler:(id *)btn{
    
    [self popViewControllerAnimated:YES];
    
}

@end
